

<template tag="以下文档内容为hycli自动生成">
  <el-dialog
    v-model="conf.visible"
    v-if="conf.visible" 
    :title="title"
    :width="conf.width"
    draggable
    align-center="true"
    :close-on-click-modal="false"
  >
<el-form :model="form"  ref="form" :rules="rules_aaabf">
    <el-row>
    <el-col :span="12">
    <!-- {"index":6,"raw":"name","name":"name","cname":"Name","type":{"raw":"varchar2(48)","name":"varchar2","len":48,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","u","le","q","DN","v","ROW(1)","lw(160)","arc","#like","@title"],"desc":{"raw":"名称","name":"名称"}} -->
    <!--名称 输入控件 -->
    <el-form-item prop="name" label="名称" label-width="100px" label-position="right">
      <el-input clearable style="width: 100%" v-model="form.name"  maxlength="48" 
      :rows="0"  placeholder="请输入名称"  />
      </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":7,"raw":"system","name":"system","cname":"System","type":{"raw":"varchar2(32)","name":"varchar2","len":32,"dlen":0},"defValue":"","allowNull":true,"constraints":["l","q","le","c","u","sl(olb_system,-,#lob_id)","tp(cascader,c-u-q)","v","show(m,l)","deep(2)"],"desc":{"raw":"系统","name":"系统"}} -->
     <!--系统 选择树 -->
     <el-form-item  label="系统" label-width="100px" label-position="right">
        <el-cascader ref="cascader_aaaah" style="width: 100%;"
        v-model="form.system" 
        placeholder="请选择系统"
        collapse-tags  collapse-tags-tooltip  clearable   :options="systemList"
        :props="{  children: 'children', label: 'name' }" />
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":8,"raw":"source","name":"source","cname":"Source","type":{"raw":"number(2)","name":"number","len":2,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","le","u","v","sl","tp(radio)"],"desc":{"raw":"来源","name":"来源"}} -->
    <el-form-item prop="source" label="来源" label-width="100px" label-position="right">
      <el-radio-group v-model="form.source"   >
        <el-radio-button v-for="item in sourceList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":9,"raw":"priority","name":"priority","cname":"Priority","type":{"raw":"number(1)","name":"number","len":1,"dlen":0},"defValue":"0","allowNull":false,"constraints":["c","l","le","u","v","fq","sl(PRI)","tp(radio,c-u)","tp(tag,l)","lw(80)","color"],"desc":{"raw":"优先级","name":"优先级"}} -->
    <el-form-item prop="priority" label="优先级" label-width="100px" label-position="right">
      <el-radio-group v-model="form.priority"   >
        <el-radio-button v-for="item in priorityList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":10,"raw":"pmaster","name":"pmaster","cname":"Pmaster","type":{"raw":"number(8)","name":"number","len":8,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","u","le","v","sl(pmaster,-,#lob_id)","tp(radio)","fq","lw(60)","color","ps(full)"],"desc":{"raw":"产品","name":"产品"}} -->
    <el-form-item prop="pmaster" label="产品" label-width="100px" label-position="right">
      <el-radio-group v-model="form.pmaster"   >
        <el-radio-button v-for="item in pmasterList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":11,"raw":"dmaster","name":"dmaster","cname":"Dmaster","type":{"raw":"number(8)","name":"number","len":8,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","le","u","q","v","sl(dmaster,-,#lob_id)","tp(radio,c-u)","fq","tp(multiselect,q)","lw(60)","ps(full)"],"desc":{"raw":"研发","name":"研发"}} -->
    <el-form-item prop="dmaster" label="研发" label-width="100px" label-position="right">
      <el-radio-group v-model="form.dmaster"   >
        <el-radio-button v-for="item in dmasterList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":12,"raw":"tmaster","name":"tmaster","cname":"Tmaster","type":{"raw":"number(8)","name":"number","len":8,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","le","u","v","sl(tmaster,-,#lob_id)","tp(radio)","fq","lw(80)","lidx(108)","color"],"desc":{"raw":"测试","name":"测试"}} -->
    <el-form-item prop="tmaster" label="测试" label-width="100px" label-position="right">
      <el-radio-group v-model="form.tmaster"   >
        <el-radio-button v-for="item in tmasterList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":13,"raw":"omaster","name":"omaster","cname":"Omaster","type":{"raw":"number(8)","name":"number","len":8,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","le","u","v","sl(dmaster,5,#lob_id)","tp(radio)"],"desc":{"raw":"部署","name":"部署"}} -->
    <el-form-item prop="omaster" label="部署" label-width="100px" label-position="right">
      <el-radio-group v-model="form.omaster"   >
        <el-radio-button v-for="item in omasterList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":14,"raw":"pmstatus","name":"pmstatus","cname":"Pmstatus","type":{"raw":"number(2)","name":"number","len":2,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","le","q","u","v","w","sl","tp(multiselect,q)","fq","tp(radio,c-u-w-fx)","color","lw(80)","fx"],"desc":{"raw":"项目状态","name":"项目状态"}} -->
    <el-form-item prop="pmstatus" label="项目状态" label-width="100px" label-position="right">
      <el-radio-group v-model="form.pmstatus"   >
        <el-radio-button v-for="item in pmstatusList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":15,"raw":"dstatus","name":"dstatus","cname":"Dstatus","type":{"raw":"number(2)","name":"number","len":2,"dlen":0},"defValue":"","allowNull":false,"constraints":["c","l","le","u","v","w","sl","tp(radio,c-u-w-fx)","fq","tp(multiselect,q)","tp(tag)","color","fx"],"desc":{"raw":"研发状态","name":"研发状态"}} -->
    <el-form-item prop="dstatus" label="研发状态" label-width="100px" label-position="right">
      <el-radio-group v-model="form.dstatus"   >
        <el-radio-button v-for="item in dstatusList" :key="item.value" :label="item.value" >
            {{item.name}}
        </el-radio-button>
      </el-radio-group>
    </el-form-item>
    </el-col>
    <el-col :span="24">
    <!-- {"index":18,"raw":"content","name":"content","cname":"Content","type":{"raw":"varchar2(2000)","name":"varchar2","len":2000,"dlen":0},"defValue":"","allowNull":false,"constraints":["ROW(4)","q","c","le","u","v","rows(3)","#like","tp(rtext,c-u)"],"desc":{"raw":"内容","name":"内容"}} -->
    <!--内容 输入控件 -->
    <el-form-item prop="content" label="内容" label-width="100px" label-position="right">
      <rtext :html="form.content" :rows="3" @onChange="onRtextcontentChange"></rtext>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":19,"raw":"req_ass_time","name":"req_ass_time","cname":"ReqAssTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","u","v","x","y","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 09:00:00)","tp(daterange,q)","fx"],"desc":{"raw":"需求评估","name":"需求评估"}} -->
    <!--需求评估 日期控件 -->
    <el-form-item prop="req_ass_time" label="需求评估" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.req_ass_time" clearable type="datetime"
        placeholder="请选择需求评估" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":20,"raw":"tch_sol_ass_time","name":"tch_sol_ass_time","cname":"TchSolAssTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","u","v","x","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 09:00:00)","fx"],"desc":{"raw":"方案评审","name":"方案评审"}} -->
    <!--方案评审 日期控件 -->
    <el-form-item prop="tch_sol_ass_time" label="方案评审" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.tch_sol_ass_time" clearable type="datetime"
        placeholder="请选择方案评审" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":21,"raw":"test_case_time","name":"test_case_time","cname":"TestCaseTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","u","v","x","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 09:00:00)","fx"],"desc":{"raw":"用例评审","name":"用例评审"}} -->
    <!--用例评审 日期控件 -->
    <el-form-item prop="test_case_time" label="用例评审" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.test_case_time" clearable type="datetime"
        placeholder="请选择用例评审" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":22,"raw":"join_test_time","name":"join_test_time","cname":"JoinTestTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","u","v","x","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 09:00:00)","fx"],"desc":{"raw":"联调开始","name":"联调开始"}} -->
    <!--联调开始 日期控件 -->
    <el-form-item prop="join_test_time" label="联调开始" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.join_test_time" clearable type="datetime"
        placeholder="请选择联调开始" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 09:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":23,"raw":"checkin_test_time","name":"checkin_test_time","cname":"CheckinTestTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["l","c","le","u","v","x","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 18:00:00)","show(m,l)","fx"],"desc":{"raw":"提测截止","name":"提测截止"}} -->
    <!--提测截止 日期控件 -->
    <el-form-item prop="checkin_test_time" label="提测截止" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.checkin_test_time" clearable type="datetime"
        placeholder="请选择提测截止" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 18:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":24,"raw":"complete_test_time","name":"complete_test_time","cname":"CompleteTestTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","u","v","q","f(MM/dd HH时)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 18:00:00)","fx"],"desc":{"raw":"测试完成","name":"测试完成"}} -->
    <!--测试完成 日期控件 -->
    <el-form-item prop="complete_test_time" label="测试完成" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.complete_test_time" clearable type="datetime"
        placeholder="请选择测试完成" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 18:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":25,"raw":"prod_deploy_time","name":"prod_deploy_time","cname":"ProdDeployTime","type":{"raw":"date","name":"date","len":0,"dlen":0},"defValue":"","allowNull":true,"constraints":["c","le","l","u","v","y","x","q","f(MM/dd HH时)","tp(datetime,c-u)","tp(daterange)","tp(datetime,c-u-fx,yyyy/MM/dd 18:00:00)","fx"],"desc":{"raw":"计划上线","name":"计划上线"}} -->
    <!--计划上线 日期控件 -->
    <el-form-item prop="prod_deploy_time" label="计划上线" label-width="100px" label-position="right">
      <el-date-picker style="width: 100%" v-model="form.prod_deploy_time" clearable type="datetime"
        placeholder="请选择计划上线" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" 
         :default-time="new Date($theia.str.dateFormat(new Date(),'yyyy/MM/dd 18:00:00'))"/>
    </el-form-item>
    </el-col>
    <el-col :span="12">
    <!-- {"index":26,"raw":"sponsor","name":"sponsor","cname":"Sponsor","type":{"raw":"varchar2(32)","name":"varchar2","len":32,"dlen":0},"defValue":"","allowNull":true,"constraints":["q","c","u","le","v","rows(1)"],"desc":{"raw":"发起人","name":"发起人"}} -->
    <!--发起人 输入控件 -->
    <el-form-item prop="sponsor" label="发起人" label-width="100px" label-position="right">
      <el-input clearable style="width: 100%" v-model="form.sponsor"  maxlength="32" 
      :rows="1"  placeholder="请输入发起人"  />
      </el-form-item>
    </el-col>
    </el-row>
</el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="hide" icon="close">取消</el-button>
        <el-button type="primary" @click="save" icon="select">提交</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import rtext from "@/views/cmpnts/rtext.vue"
export default {
  components: {
    rtext
},
  data() {
    return {
      conf: {
        visible: false,
        width:this.$size.gt("m")?"50%":"70%",
        uploadPath:this.$theia.env.join("/file/upload"),
      },
      title:"修改研发计划",
rules_aaabf:{
    name:[{required:true,message:"请输入名称",trigger: 'blur'}],
    system:[{required:false,message:"请输入系统",trigger: 'blur'}],
    source:[{required:true,message:"请输入来源",trigger: 'blur'}],
    priority:[{required:true,message:"请输入优先级",trigger: 'blur'}],
    pmaster:[{required:true,message:"请输入产品",trigger: 'blur'}],
    dmaster:[{required:true,message:"请输入研发",trigger: 'blur'}],
    tmaster:[{required:true,message:"请输入测试",trigger: 'blur'}],
    omaster:[{required:true,message:"请输入部署",trigger: 'blur'}],
    pmstatus:[{required:true,message:"请输入项目状态",trigger: 'blur'}],
    dstatus:[{required:true,message:"请输入研发状态",trigger: 'blur'}],
    content:[{required:true,message:"请输入内容",trigger: 'blur'}],
    req_ass_time:[{required:false,message:"请输入需求评估",trigger: 'blur'}],
    tch_sol_ass_time:[{required:false,message:"请输入方案评审",trigger: 'blur'}],
    test_case_time:[{required:false,message:"请输入用例评审",trigger: 'blur'}],
    join_test_time:[{required:false,message:"请输入联调开始",trigger: 'blur'}],
    checkin_test_time:[{required:false,message:"请输入提测截止",trigger: 'blur'}],
    complete_test_time:[{required:false,message:"请输入测试完成",trigger: 'blur'}],
    prod_deploy_time:[{required:false,message:"请输入计划上线",trigger: 'blur'}],
    sponsor:[{required:false,message:"请输入发起人",trigger: 'blur'}],
  },
    form:{
        name:"",
        system:"",
        source:"",
        priority:"",
        pmaster:"",
        dmaster:"",
        tmaster:"",
        omaster:"",
        pmstatus:"",
        dstatus:"",
        content:"",
        req_ass_time:"",
        tch_sol_ass_time:"",
        test_case_time:"",
        join_test_time:"",
        checkin_test_time:"",
        complete_test_time:"",
        prod_deploy_time:"",
        sponsor:"",
    },
    systemList:[],
    sourceList:[],
    priorityList:[],
    pmasterList:[],
    dmasterList:[],
    tmasterList:[],
    omasterList:[],
    pmstatusList:[],
    dstatusList:[],
    }
  },
  methods: {
    show(form) {
    this.title = form.name||this.title
      this.conf.visible = true;
      this.loadEnums_aaabf()
      this.form = Object.assign(form,this.$route.params)
      this.get(form)
    },
      get(form){
        let that = this
        this.conf.loading = true
        let postForm = {}
        postForm.plan_id = form.plan_id
        this.$theia.http.get("/ws/dev/plan",postForm).then(res=>{
          that.form = Object.assign(that.form, res)
          that.form.system = that.form.system
        //处理枚举重新绑定
          this.loadEnums_aaabf()
          that.conf.loading = false
        }).catch(res=>{
          let code = ((res||{}).response||{}).status||0
          let msg = `研发计划查询失败(${code})`
          that.$notify.error({title: '失败',message:msg ,duration:5000})
        })
    },
    save(){
        this.$refs.form.validate((v=>{
            if(v) this.onSave()
        }))
    },
    onSave(){
      let that = this
        let postForm = Object.assign({},this.form)
        let system = []
        let systemNodes = this.$refs.cascader_aaaah.getCheckedNodes() || []
        systemNodes.forEach(v => {
          system.push(v.value)
        })
        postForm.system = system.join(",")
        this.$theia.http.put("/ws/dev/plan",postForm).then(res=>{
            that.$notify.success({title: '成功',message: '研发计划保存成功',duration:5000})
            that.$theia.enum.clear("dev_plan")
            that.$theia.enum.get("dev_plan")
            that.hide()
            that.$emit("onsaved")
        }).catch(res=>{
            let code = ((res||{}).response||{}).status||0
            let msg = `研发计划修改失败(${code})`
            that.$notify.error({title: '失败',message: msg,duration:5000})
        })
    },
    hide() {
      this.conf.visible = false;
      this.$refs.form.resetFields();
    },
    onRtextcontentChange(text,urls){
      this.form.content = text
      this.form.content_urls = (urls||[]).join(",")
    },
     onUploadSuccess(response){
    },
    loadEnums_aaabf(){
        //系统
        this.systemList = this.$theia.enum.getTree("olb_system","",this.$theia.user.get("lob_id"),2)
        //来源
        this.sourceList = this.$theia.enum.get("source","","" ,false,"")
        //优先级
        this.priorityList = this.$theia.enum.get("PRI","","" ,false,"")
        //产品
        this.pmasterList = this.$theia.enum.get("pmaster","",this.$theia.user.get("lob_id"),false,"")
        //研发
        this.dmasterList = this.$theia.enum.get("dmaster","",this.$theia.user.get("lob_id"),false,"")
        //测试
        this.tmasterList = this.$theia.enum.get("tmaster","",this.$theia.user.get("lob_id"),false,"")
        //部署
        this.omasterList = this.$theia.enum.get("dmaster","5",this.$theia.user.get("lob_id"),false,"")
        //项目状态
        this.pmstatusList = this.$theia.enum.get("pmstatus","","" ,false,"")
        //研发状态
        this.dstatusList = this.$theia.enum.get("dstatus","","" ,false,"")
    },

  },
};
</script>

<style scoped>
.form_item_info{
  margin-left: 4px;
  color:#999;
}
.form_item_info:hover{
  cursor: pointer;
  font-weight: 500;
  color:#333;
}
</style>